package com.njwb.dao.impl;

import com.njwb.dao.UserDao;
import com.njwb.entity.User;
import com.njwb.mapper.UserRowMapping;
import com.njwb.util.JDBCTemplate;

/**
 * Description: 类的描述
 * Author: yuandeyin@itany.com
 * Date: 2025-08-12 13:41
 * Version: 1.0
 */
public class UserDaoImpl implements UserDao {
    @Override
    public int insert(User user) {
        String sql = "insert into t_user(t_phone,t_pwd) values(?,?)";
        return JDBCTemplate.insert(sql,user.getPhone(),user.getPwd());
    }

    @Override
    public User findByPhone(String phone) {
        String sql = "select t_phone,t_pwd from t_user where t_phone = ?";
        return JDBCTemplate.selectOne(sql,new UserRowMapping(),phone);
    }
}
